-
-
Notifications
You must be signed in to change notification settings - Fork 37
fix: android auto responsive sheet size #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: android auto responsive sheet size #193
Conversation
@lovegaoshi is attempting to deploy a commit to the Jovanni's projects Team on Vercel. A member of the Team first needs to authorize it. |
Code Climate has analyzed commit a7bbe47 and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Thanks @lovegaoshi. I'll test over the weekend. |
@lovegaoshi tested and works. however, it is now draggable to full screen height. Can we disable that and have it draggable up until specified max height? |
I dont know if that is technically feasible - that requires changing maxHeight which per documentation should only be specified when the sheet is closed. Perhaps there are hacks that either
|
Yeah, try 2nd option. It might be advised to only set maxHeight when closed due for UX purposes since it can't be animated (bad UI for the user). Since we don't get any error so I guess it's kinda "ok" 😅 |
ok. i actually got it working but its very hacked to me. we already saw #192 doesnt give you an animation. the issue is bottomSheetBehavior.state === EXPANDED will NOT animate. only COLLAPSED with seekHeight animates. actually if instead of using EXPANDED in #192 but use COLLAPSED, and put bottomSheet.state = COLLAPSED before setting the bottomsheetView.layout, this will work for half the problem - 'collapse' (content from high to low height) will animate but 'expand' (low to high) will not then I have a very hacky solution that sets the height to -2 then use a bottomSheetCallback monitoring the first time onSlide triggers with offset = 0 (finished sliding) to set layout height. it works both ways now, but its quite a mess. solution 1: (see how onSlide does not log on expand anymore) Screencast.from.07-08-2025.04.22.24.PM.webmsolution 2: Screencast.from.07-08-2025.04.21.30.PM.webm |
Have you tried intercepting touch gesture? |
im not comfortable writing an ontouch intercept logic to effectively disable bottomsheet.behavior.EXPANDED, ideas welcome i did set maxHeight to -1 instead of value + footerHeight in the 2nd approach - if view.layout.height just has to be slightly higher than peekHeight to trigger the animation, this could be an easy solution. otherwise i guess fixing the layout height in onSlide is the only way out |
this sets layout.height right after STATE.COLLAPSED is set to give an animation effect. sometimes janky.
i spent a bit more time and found some leads. though im sorta lost here and need another pair of eyes. I did confirm my hypothesis that view.layout.height just has to be slightly higher than peekHeight to trigger the animation - presented in solution 1, I override truesheetview.layout.height to peekHeight + 1 to give an animation. but this animation is janky in my testings. expand doesnt expand quite to the exact hight and collapse is too fast. the solution 2 is the hacky solution i mentioned before - only override truesheetview.layout.height to peekheight AFTER the first completed onSlide (which is the animation trigger from content size change). this way bc collapse no longer overrides the layout up front, the animation is a lot smoother; and for unexplained reasons now the expand can also expand to full length. the downside is extra complicated code logic and obviously user scrolls during animation will have side effects. of course I can also do a isDraggable = false then set it to true. |
@lovegaoshi I agree, animating size change is too hacky. Let's just stick with no-animation approach. I've committed to simplify things, hope you don't mind :) |
alright. I'll probably adapt this code in my fork instead. I like
animations:)
…On Wed, Jul 9, 2025 at 3:20 PM Jovanni Lo ***@***.***> wrote:
*lodev09* left a comment (lodev09/react-native-true-sheet#193)
<#193 (comment)>
@lovegaoshi <https://github.com/lovegaoshi> I agree, animating size
change is too hacky. Let's just stick with no-animation approach. I've
committed to simplify things, hope you don't mind :)
—
Reply to this email directly, view it on GitHub
<#193 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZMOVVTLSDI5YWPSSBATW4D3HWIUTAVCNFSM6AAAAACASX7OFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANJUGI3DQNJRGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Go for it! Although you might as well use |
this PR implements the strategy mentioned in #192 (comment) to auto adjust bottom sheet height on content height change. I replaced when the only size is "auto"'s bottomsheetbehavior to COLLAPSED instead of EXPANDED, so its height can be adjusted after the sheet is shown.
test is done using a custom component in my app instead of the test code mentioned in the above PR/linked issue, but the idea is the same.
Screen.Recording.2025-07-01.204012.mp4